home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-04-30 | 2.4 KB | 73 lines | [TEXT/MPS ] |
- {[j=20/53/1$] Pasmat Options}
-
- UNIT URectStack;
-
- {-------------------------------------------------------------------------------------------
-
- Program: FracApp 2.0
- Unit: URectStack
- File: URectStack.p
- Includes: URectStack.inc1.p
-
- by Keith Rollin & Bo3b Johnson
- of Apple Macintosh Developer Technical Support
-
- Copyright © 1989-1990 Apple Computer, Inc.
- All rights reserved.
-
- --------------------------------------------------------------------------------------------
-
- This unit implements a stack for storing Rects. It defines a TRectStack class
- that is based on the new TDynamicArray class in MacApp 2.0 final. It’s used by
- the fast FracApp engine in keeping track of the areas of the fractal document
- that need to be calculated.
-
- There are 4 major methods of interest. PushRect and PopRect take care of adding
- Rects to and removing Rects from the stack. EachRect is used to iterate over
- all of the Rects on the stack. This is used by the TFracAppEngine’s DoWrite
- method when it needs to save the stack to disk. Finally, there is the
- ClearStack method that is used to put the stack into a virgin state.
-
- --------------------------------------------------------------------------------------------}
-
- INTERFACE
-
- USES UMacApp, Types, Memory;
-
- TYPE
-
- TRectStack = OBJECT (TDynamicArray)
-
- PROCEDURE TRectStack.IRectStack(initialNumberOfRects: Integer);
- { Calls IDynamicArray with “initialNumberOfRects” and an element size of
- SizeOf(Rect) }
-
- PROCEDURE TRectStack.ClearStack;
- { Remove all Rects from the stack. The stack is left empty. }
-
- PROCEDURE TRectStack.EachRect(PROCEDURE
- DoToRect(theRect: Rect); direction: Boolean);
- { Calls the passed DoToRect procedure for each item on the stack. It traverses
- the stack in ‘direction’ order. If ‘direction’ is kForward, then we start
- with the first element pushed onto the stack, and proceed to the last (most
- recent) element on the stack. }
-
- PROCEDURE TRectStack.PushRect(theRect: Rect);
- { Takes the Rect you pass it, and pushes it on the stack. }
-
- PROCEDURE TRectStack.PopRect(VAR theRect: Rect);
- { Returns the first Rect on the stack. That Rect is then removed from
- the stack. }
-
- PROCEDURE TRectStack.Fields(PROCEDURE
- DoToField(fieldName: Str255; fieldAddr: Ptr;
- fieldType: Integer)); OVERRIDE;
-
- END;
-
- IMPLEMENTATION
-
- {$I URectStack.inc1.p}
-
- END.
-